#ifndef FRESHDIALOG_H
#define FRESHDIALOG_H

#include <BXmlNode>
#include <BXmlDocument>
#include <BTreeWidget>
#include <BTextEdit>
#include <BButton>
#include <BFile>
#include <BLabel>
#include <BDialog>
#include <BSpacer>

using namespace BWE;

class FreshDialog : public BDialog
{
public:
	FreshDialog(BWidget* parent = 0);
	~FreshDialog();

	bool open(const BString& fileName);
	bool load(const BString& htmlFileName);
	bool save();

protected:
	int strideMethodContent(const BString& text, int pos);
	void createDescription(BXmlNode* body);
	void collectMethods(BXmlNode* body, const BString& text, int& pos, int& number);
	void attachPublicMethods(BTreeItem* item);
	void attachProtectedMethods(BTreeItem* item);

protected:
	void procSave();
	void procCancel();

protected:
	virtual void updateEvent(const BEvent& event);

private:
	BString				_fileName;
	BString				_htmlFileName;
	BXmlNodeHolder		_headRoot;
	BXmlNodeHolder		_htmlRoot;

	BTreeItemHolder		_item;
	BTreeWidget*		_treeWidget;
	BSpacer*			_spacer;

	BButton*			_saveButton;
	BButton*			_cancelButton;
};

#endif
